package com.java.jvm.loader;
import com.sun.org.apache.xml.internal.res.XMLErrorResources_tr;
//-XX:+TraceClassLoading
class ClassM{
    static int num=100;
    static {
        System.out.println("ClassM.static");
    }
    public static void doMethod01(){}
    public static void doMethod02(){
        System.out.println(ClassN.x);
    }
}
class ClassN extends ClassM{
    public static int x=10;
    static {
        System.out.println("ClassN.static");
    }
}
class ClassK{
    static int count=10;
    static{
        System.out.println("ClassK.static");
    }

}
public class StaticTests01 {
    public static void main(String[] args) {
        //Class<ClassM> c1 = ClassM.class;//类会被加载，但静态代码块不执行
        //ClassM.doMethod01();
        //int num = ClassM.num;
        //System.out.println(num);
        //ClassM.doMethod02();
        //System.out.println(ClassN.x);
        System.out.println(ClassN.num);//ClassN会被加载，但静态代码块不会执行
    }
}
